package org.iteam.web.struts.service;

import java.util.List;
import java.util.Map;

/**
 * 服务接口类
 * 
 * @author jacky
 * 
 * @param <T>
 */
public interface ModelService<T> {
	/**
	 * 查询所有
	 * 
	 * @return
	 * @throws Exception
	 */
	public List<T> query() throws Exception;

	public List<T> query(Map<String, Object> map) throws Exception;

	/**
	 * 按父亲查询所有
	 * 
	 * @param parentId
	 * @return
	 * @throws Exception
	 */
	public List<T> queryByParent(String parent) throws Exception;

	public List<T> queryByParent(String parent, Map<String, Object> map)
			throws Exception;

	/**
	 * 分页查询
	 * 
	 * @param page
	 * @param rows
	 * @return
	 * @throws Exception
	 */
	public List<T> queryByPage(long page, long rows) throws Exception;

	public List<T> queryByPage(long page, long rows, Map<String, Object> map)
			throws Exception;

	/**
	 * 分页按父亲查询
	 * 
	 * @param page
	 * @param rows
	 * @return
	 * @throws Exception
	 */
	public List<T> queryByPageAndParent(long page, long rows, String parent)
			throws Exception;

	public List<T> queryByPageAndParent(long page, long rows, String parent,
			Map<String, Object> map) throws Exception;

	/**
	 * 统计所有
	 * 
	 * @return
	 * @throws Exception
	 */
	public long count() throws Exception;

	public long count(Map<String, Object> map) throws Exception;

	/**
	 * 统计按父亲查询所有
	 * 
	 * @param parent
	 * @return
	 * @throws Exception
	 */
	public long countByParent(String parent) throws Exception;

	public long countByParent(String parent, Map<String, Object> map)
			throws Exception;

	/**
	 * 获取单挑记录
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public T show(String id) throws Exception;

	/**
	 * 新增
	 * 
	 * @param object
	 * @return
	 */
	public boolean create(T object);

	/**
	 * 更新
	 * 
	 * @param object
	 * @return
	 */
	public boolean update(T object);

	/**
	 * 删除
	 * 
	 * @param id
	 * @return
	 */
	public boolean delete(String id);

	/**
	 * 销毁
	 * 
	 * @param id
	 * @return
	 */
	public boolean destroy(String id);

}
